Ext.define('DCApp.view.book.Detail', {
    extend: 'DCApp.view.Detail',
    alias: 'widget.bookdetail',
    
    requires: ['DCApp.ux.ComboTree'],
    bind: {
        title: '图书 - 【{theObj.objId}】'
    },
    
    componentCls: 'book-detail',
    bodyPadding: 0,
    
    controller: 'detail',
    
    afterRender: function(ct, position) {
    	var imgpanel = this.down('imgpanel');
    	if(imgpanel){
	    	var tb = imgpanel.down('toolbar[dock=top]');
	    	tb.insert(1,[{
	    		text:'插入'
	    	}]);
    	}
    	var attachpanel = this.down('attachpanel');
    	if (attachpanel) {
	    	var tb = attachpanel.down('toolbar[dock=top]');
	    	tb.insert(1,[{
	    		text:'插入'
	    	}]);
    	}
    	this.callParent();
    },
    items: [{
    	listeners: {
		  render: function(p){
			p = p.getEl();
			var me= this.up();
			me.h0=p.getHeight();
		    p.on('scroll', function(e, t){
		    	me.onscroll(t.scrollTop,t.clientHeight);
		    }, p);
		  }
		},
    	title: 'Panel 0',
        flex: 2,
        frame: false,
        xtype: 'container',
        layout: 'anchor',
        style: {
            overflow: 'auto'
        },
        items: [
        	{
				title : '图书信息',
				margin : '0 0 10 0',
				cls : 'nav_pos',
				reference : 'form',
				bodyPadding : 10,
				fieldDefaults : {
					labelAlign : 'right',
					labelWidth : 100,
					padding : 3
				},
				defaults : {
					anchor : '100%'
				},
				xtype: 'form',
        		items: [
		        	{
		                xtype: 'container',
		                layout: 'hbox',
		                combineErrors: true,
		                defaultType: 'textfield',
		                items:[
		                    {
		                    	flex: 1,
		                        fieldLabel: '撰稿人',
		                        allowBlank: false,
		                        bind: '{theObj.author}',
		                        publishes: ['value']
		                    },
		                    {
		                		flex: 1,
		                        fieldLabel: '内容分类',
		                        allowBlank: false,
		                        bind: '{theObj.className}',
		                        publishes: ['value']
		                    }	                        
		        		]
		    		},
		    		{
		                xtype: 'container',
		                layout: 'hbox',
		                combineErrors: true,
		                defaultType: 'textfield',
		                items:[
		                    {
		                    	flex: 1,
		                        fieldLabel: '形式分类',
		                        allowBlank: false,
		                        bind: '{theObj.objProdarea}',
		                        publishes: ['value']
		                    },
		                    	{
		                		flex: 1,
		                        fieldLabel: '图书编号',
		                        allowBlank: false,
		                        bind: '{theObj.objNo}',
		                        publishes: ['value']
		                    }	                        
		        		]
		    		},
		    		{
		                xtype: 'container',
		                layout: 'hbox',
		                combineErrors: true,
		                defaultType: 'textfield',
		                items:[
		                    {
		                    	flex: 1,
		                        fieldLabel: '图书名称',
		                        allowBlank: false,
		                        bind: '{theObj.objName}',
		                        publishes: ['value']
		                    },
		                    	{
		                		flex: 1,
		                        fieldLabel: '出版日期',
		                        allowBlank: false,
		                        bind: '{theObj.generateEra}',
		                        publishes: ['value']
		                    }	                        
		        		]
		    		},
		    		{
		                xtype: 'container',
		                layout: 'hbox',
		                combineErrors: true,
		                defaultType: 'textfield',
		                items:[
		                    {
		                    	flex: 1,
		                        fieldLabel: '出版社',
		                        allowBlank: false,
		                        bind: '{theObj.publishHouse}',
		                        publishes: ['value']
		                    },
		                    {
		                		flex: 1,
		                        fieldLabel: '相关文稿编号',
		                        allowBlank: false,
		                        bind: '{theObj.reldocid}',
		                        publishes: ['value']
		                    }	                        
		        		]
		    		},
		    		{
		                xtype: 'container',
		                layout: 'hbox',
		                combineErrors: true,
		                defaultType: 'textfield',
		                items:[
		                    {
		                    	flex: 1,
		                        fieldLabel: '图书作者',
		                        allowBlank: false,
		                        bind: '{theObj.objAuthor}',
		                        publishes: ['value']
		                    },
		                    {
		                		flex: 1,
		                        fieldLabel: '图书总目在售标记',
		                        allowBlank: false,
		                        bind: '{theObj.sell}',
		                        publishes: ['value']
		                    }	                        
		        		]
		    		},
		    		{
		                xtype: 'container',
		                layout: 'hbox',
		                combineErrors: true,
		                defaultType: 'textfield',
		                items:[
		                    {
		                    	flex: 1,
		                        fieldLabel: '是否介绍故宫',
		                        xtype: 'textfield',
		                        allowBlank: false,
		                        bind: '{theObj.iscollection}',
		                        publishes: ['value']             
		                    },
		                    {
		                		flex: 1,
		                        fieldLabel: '是否推荐',
		                        allowBlank: false,
		                        xtype: 'textfield',
		                        bind: '{theObj.iscommend}',
		                        publishes: ['value']
		                    }	                        
		        		]
		    		},
		    		{
		                xtype: 'container',
		                layout: 'hbox',
		                combineErrors: true,
		                defaultType: 'textfield',
		                items:[
		                    {
		                    	flex: 1,
		                        fieldLabel: '图书总目开本',
		                        allowBlank: false,
		                        bind: '{theObj.format}',
		                        publishes: ['value']
		                    },
		                    {
		                		flex: 1,
		                        fieldLabel: '图书总目装订',
		                        allowBlank: false,
		                        bind: '{theObj.bookbinding}',
		                        publishes: ['value']
		                    }	                        
		        		]
		    		},
		    		{
		                xtype: 'container',
		                layout: 'hbox',
		                combineErrors: true,
		                defaultType: 'textfield',
		                items:[
		                    {
		                    	flex: 1,
		                        fieldLabel: '图书总目字数/图数',
		                        allowBlank: false,
		                        bind: '{theObj.wordPicture}',
		                        publishes: ['value']
		                    },
		                    {
		                		flex: 1,
		                        fieldLabel: '图书总目包本',
		                        allowBlank: false,
		                        bind: '{theObj.packaging}',
		                        publishes: ['value']
		                    }	                        
		        		]
		    		},
		    		{
		                xtype: 'container',
		                layout: 'hbox',
		                combineErrors: true,
		                defaultType: 'textfield',
		                items:[
		                    {
		                    	flex: 1,
		                        fieldLabel: '图书总目价格',
		                        allowBlank: false,
		                        bind: '{theObj.price}',
		                        publishes: ['value']
		                    },
		                    {
		                		flex: 1,
		                        fieldLabel: '图书总目订数/备注',
		                        allowBlank: false,
		                        bind: '{theObj.countRemark}',
		                        publishes: ['value']
		                    }	                        
		        		]
		    		},
		            {
		                xtype: 'container',
		                layout: 'hbox',	
		                items: [
		                	{
		                		flex: 4,
						        xtype: 'filefield',
						        name: 'file1',
						        fieldLabel: '上传',
						        emptyText : '请选择文件...',
						        buttonText: '选择文件'
						    },
						    {
						    	flex: 1,
						    	xtype: 'button',
						    	text: '上传',
		      					handler: 'onUploadBook'
						    }
		        		]
		            },
		            {
		        		xtype: 'htmleditor',
		        		bind: '{theBook.description}',
		        		publishes: ['value'],
		        		fieldLabel: '图书摘要'                    		                    		
		           	}
           	]
        	}
		]
    }]
});
